/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Models;

import Controllers.DBUtility;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Pan
 */
public class Wanted {
    private int ID;
    private Criminal RelatedCriminal;
    private Date WantedDate;
    private int BountyMoney;
    private String SightingPlace;
    private Date SightingTime;
    private boolean InEffect;

    public int getBountyMoney() {
        return BountyMoney;
    }

    public void setBountyMoney(int BountyMoney) {
        this.BountyMoney = BountyMoney;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public boolean isInEffect() {
        return InEffect;
    }

    public void setInEffect(boolean InEffect) {
        this.InEffect = InEffect;
    }

    public Criminal getRelatedCriminal() {
        return RelatedCriminal;
    }

    public void setRelatedCriminal(Criminal RelatedCriminal) {
        this.RelatedCriminal = RelatedCriminal;
    }

    public String getSightingPlace() {
        return SightingPlace;
    }

    public void setSightingPlace(String SightingPlace) {
        this.SightingPlace = SightingPlace;
    }

    public Date getSightingTime() {
        return SightingTime;
    }

    public void setSightingTime(Date SightingTime) {
        this.SightingTime = SightingTime;
    }

    public Date getWantedDate() {
        return WantedDate;
    }

    public void setWantedDate(Date WantedDate) {
        this.WantedDate = WantedDate;
    }

    public Wanted() {
    }

    public Wanted(int ID) {
        Connection conn = DBUtility.openConnection();
        try {
            CallableStatement cs = conn.prepareCall("{call sp_GetWantedByID(?)}");
            cs.setInt(1, ID);
            ResultSet rs = cs.executeQuery();
            if (rs.next()) {
                this.ID = rs.getInt("WantedID");
                RelatedCriminal = new Criminal(rs.getInt("CriminalID"));
                WantedDate = rs.getDate("WantedDate");
                BountyMoney = rs.getInt("BountyMoney");
                SightingPlace = rs.getString("SightingPlace");
                SightingTime = rs.getDate("SightingTime");
                InEffect = rs.getBoolean("InEffect");
            }
            rs.close();
        } catch (SQLException ex) {
            Logger.getLogger(Wanted.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
